package com.fan.share;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.material.bottomsheet.BottomSheetDialogFragment;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * BottomSheetDialogFragment 基类
 *
 * @author fan
 * @date 2018/12/6
 */

public abstract class BaseBottomSheetDialogFragment extends BottomSheetDialogFragment {


    private View mRootView;

    @Nullable
    @Override
    public View onCreateView (@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState ) {
        inflaterView( inflater, container );
        initView( mRootView );
        return mRootView;
    }

    private void inflaterView ( LayoutInflater inflater, @Nullable ViewGroup container ) {
        if ( mRootView == null ) {
            mRootView = inflater.inflate( getScrollViewContentLayoutId(), container, false );
        }
    }

    @Override
    public void onDestroyView () {
        super.onDestroyView();
    }

    /**
     * 布局文件
     *
     * @return 布局文件
     */
    public abstract int getScrollViewContentLayoutId ();

    /**
     * findViewId
     *
     * @param view view
     */
    protected abstract void initView ( View view );
}
